

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Collection [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Automation Interface,Automation Interface Repository, Collection Class,Collection Class,Collection Class Automation Interface Repository,Repository,Repository Collection Class">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Collection</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="client.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="datatype.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_SubHeadingL1"><span class="f_SubHeadingL1">public Class</span></p>
<p class="p_BodyText"><span class="f_BodyText">This is the main collection Class used by all elements within the Automation Interface. It contains methods to iterate through the collection, refresh the collection and delete an item from the collection. It is important to realize that when </span><span class="f_BodyText" style="font-style: italic;">AddNew</span><span class="f_BodyText"> is called, the item is not automatically added to the current collection. The typical steps are:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Call </span><span class="f_NumberedList" style="font-style: italic;">AddNew</span><span class="f_NumberedList"> to add a new item.</span></li>
<li value=2><span class="f_NumberedList">Modify the item as required.</span></li>
<li value=3><span class="f_NumberedList">Call </span><span class="f_NumberedList" style="font-style: italic;">Update</span><span class="f_NumberedList"> on the item to save it to the database.</span></li>
<li value=4><span class="f_NumberedList">Call </span><span class="f_NumberedList" style="font-style: italic;">Refresh</span><span class="f_NumberedList"> on the collection to include it in the current set.</span></li>
</ol>
<p class="p_BodyText"><span class="f_BodyText" style="font-style: italic;">Delete</span><span class="f_BodyText"> is much the same; until </span><span class="f_BodyText" style="font-style: italic;">Refresh</span><span class="f_BodyText"> is called, the collection still contains a reference to the deleted item, which should not be called.</span></p>
<p class="p_BodyText"><span class="f_BodyText">Each </span><span class="f_BodyText">can be used to iterate through the collection for languages that support this type of construct.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Collection Attributes</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="0" border="0" style="border: none; border-spacing:0px; border-collapse: collapse;">
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" bgcolor="#e3e6ed" style="width:155px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Attribute</span></p>
</td>
<td valign="top" width="85" bgcolor="#e3e6ed" style="width:85px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Type</span></p>
</td>
<td valign="top" width="432" bgcolor="#e3e6ed" style="width:432px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Notes</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Count</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Short</span></p>
</td>
<td valign="top" width="432" style="width:432px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Read only. The number of objects referenced by this list.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">ObjectType</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;"><a href="objecttypeenum.htm">ObjectType</a></span></p>
</td>
<td valign="top" width="432" style="width:432px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Read only. Distinguishes objects referenced through a Dispatch interface.</span></p>
</td>
</tr>
</table>
</div>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Collection Methods</span></p>
<div style="text-align: left; text-indent: 0px; padding: 0px 0px 0px 0px; margin: 5px 0px 5px 13px;"><table cellspacing="0" cellpadding="0" border="0" style="border: none; border-spacing:0px; border-collapse: collapse;">
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" bgcolor="#e3e6ed" style="width:155px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Method</span></p>
</td>
<td valign="top" width="85" bgcolor="#e3e6ed" style="width:85px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Type</span></p>
</td>
<td valign="top" width="431" bgcolor="#e3e6ed" style="width:431px; background-color:#e3e6ed; border: solid 1px #000000;"><p class="p_Tableheader"><span class="f_Tableheader">Notes</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">AddNew (string Name, string Type)</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Object</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Adds a new item to the current collection.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Note that the interface is the same for all collections; you must provide a </span><span class="f_Tabletext" style="font-style: italic;">Name</span><span class="f_Tabletext"> and</span><span class="f_Tabletext" style="font-style: italic;"> Type</span><span class="f_Tabletext"> argument. What these are used for depends on the actual collection member. Also note that you must call </span><span class="f_Tabletext" style="font-style: italic;">Update()</span><span class="f_Tabletext"> on the returned object to complete the </span><span class="f_Tabletext" style="font-style: italic;">AddNew</span><span class="f_Tabletext">. If </span><span class="f_Tabletext" style="font-style: italic;">Update()</span><span class="f_Tabletext"> is not called the object is left in an indeterminate state.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Parameters:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Name: String</span></li>
<li><span class="f_Bulletlist1">Type: String (up </span><span class="f_Tabletext">to 30 characters long)</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Delete (short Index)</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Void</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Deletes the item at the selected reference.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Parameters:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Index: Short</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">DeleteAt (short Index, boolean Refresh)</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Void</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Deletes the item at the selected index. The second parameter is currently unused.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Parameters:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Index: Short</span></li>
<li><span class="f_Bulletlist1">Refresh: Boolean</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">GetAt (short Index)</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Object</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Retrieves the array object using a numerical index. If the index is out of bounds, an error occurs.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Parameters:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Index: Short</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">GetByName (string Name)</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Object</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Gets an item in the current collection by Name.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">If the collection does not contain any items, the method returns a null value. If the collection contains items, but it was unable to find an object with the specified name, the method raises an exception.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Only supported for the following collections: Models, <a href="package_2.htm">Packages</a>, <a href="element2.htm">Elements</a>, <a href="diagram2.htm">Diagrams</a>, and element <a href="taggedvalue.htm">TaggedValues</a>.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">Parameters:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Name: String</span></li>
</ul>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">GetLastError ()</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">String</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Returns a string value describing the most recent error that occurred in relation to this object.</span></p>
<p class="p_Tabletext"><span class="f_Tabletext">This function is rarely used as an exception is thrown when an error occurs.</span></p>
</td>
</tr>
<tr style="text-align:left;vertical-align:top;">
<td valign="top" width="155" style="width:155px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-weight: bold;">Refresh ()</span></p>
</td>
<td valign="top" width="85" style="width:85px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext" style="font-style: italic;">Void</span></p>
</td>
<td valign="top" width="431" style="width:431px; border: solid 1px #000000;"><p class="p_Tabletext"><span class="f_Tabletext">Refreshes the collection by re-querying the model and reloading the collection. Should be called after adding a new item or after deleting an item.</span></p>
</td>
</tr>
</table>
</div>




            </div>
          </div>
        </div>



</div>


</body>
</html>
